import { Context } from "./Context";
import { Game } from "./Game";

export abstract class Command {
    /** 当前发送消息的角色 */
    get masterRole() {
        return this.game.getRole(this.context.getId());
    }
    constructor(protected game: Game, protected context: Context) { }
    static commandName: string;
    public getName() {
        return (this.constructor as typeof CommandSubClass).commandName;
    }
    static test(commandName: string): boolean { return this.commandName == commandName };
    abstract invoke(): void;
}

/** 这个类只表示 Command 的子类，实际运行过程中不会被执行 */
//@ts-ignore
export class CommandSubClass extends Command { }